package ro.ubbcluj.cs.damate.persistence.repository;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import ro.ubbcluj.cs.damate.persistence.entities.Event;
import ro.ubbcluj.cs.damate.persistence.entities.File;

import java.util.List;

/**
 * @author Lóránd Fazakas (lorand)
 *         Date: 5/10/12
 *         Time: 9:25 PM
 */
public interface EventRepository extends CrudRepository<Event, Long> {

    @Query("select e from Event e left join fetch e.relatedObject where e.relatedObject in ?1")
    List<Event> findByResourceFiles(List<File> files);
}
